<template>
  <div>
      用户名<input type="text" v-model="username">
      密码<input type="password" v-model="password">
      权限认证<input type="text" v-model="authority">
      部门
      <select v-model="cate">
          <option value="1">人事部</option>
          <option value="2">销售部</option>
          <option value="3">财务部</option>
      </select>
      <input type="button" @click="btn" value="添加员工">
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
          username:'',
           password:'',
            authority:'',
            cate:'',
        }
    },
    methods:{
        btn(){
            const fd={
                'username':this.username,
                'password':this.password,
                'authority':this.authority,
                'cate':this.cate
            }
            axios.post('http://127.0.0.1:8000/adduser',fd).then(resp=>{
                console.log(resp.data)
                console.log(data.errors)
                if (this.authority==1){
                    alert(resp.data.msg)
                }else{
                    alert('权限不够')
                }
                
            }).catch(error=>{
                console.log(error)
            })
        }
    }
}
</script>

<style>

</style>